<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>clapll.f</title>
 <meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!-- 
body { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default   { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default a { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.comment   { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.comment a { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
 --></style>

 </head>
  <body>

<pre>
      SUBROUTINE <a name="CLAPLL.1"></a><a href="clapll.f.html#CLAPLL.1">CLAPLL</a>( N, X, INCX, Y, INCY, SSMIN )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  -- LAPACK auxiliary routine (version 3.1) --
</span><span class="comment">*</span><span class="comment">     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment">     November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Scalar Arguments ..
</span>      INTEGER            INCX, INCY, N
      REAL               SSMIN
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      COMPLEX            X( * ), Y( * )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Purpose
</span><span class="comment">*</span><span class="comment">  =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Given two column vectors X and Y, let
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                       A = ( X Y ).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  The subroutine first computes the QR factorization of A = Q*R,
</span><span class="comment">*</span><span class="comment">  and then computes the SVD of the 2-by-2 upper triangular matrix R.
</span><span class="comment">*</span><span class="comment">  The smaller singular value of R is returned in SSMIN, which is used
</span><span class="comment">*</span><span class="comment">  as the measurement of the linear dependency of the vectors X and Y.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Arguments
</span><span class="comment">*</span><span class="comment">  =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  N       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The length of the vectors X and Y.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  X       (input/output) COMPLEX array, dimension (1+(N-1)*INCX)
</span><span class="comment">*</span><span class="comment">          On entry, X contains the N-vector X.
</span><span class="comment">*</span><span class="comment">          On exit, X is overwritten.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  INCX    (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The increment between successive elements of X. INCX &gt; 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Y       (input/output) COMPLEX array, dimension (1+(N-1)*INCY)
</span><span class="comment">*</span><span class="comment">          On entry, Y contains the N-vector Y.
</span><span class="comment">*</span><span class="comment">          On exit, Y is overwritten.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  INCY    (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The increment between successive elements of Y. INCY &gt; 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  SSMIN   (output) REAL
</span><span class="comment">*</span><span class="comment">          The smallest singular value of the N-by-2 matrix A = ( X Y ).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Parameters ..
</span>      REAL               ZERO
      PARAMETER          ( ZERO = 0.0E+0 )
      COMPLEX            CONE
      PARAMETER          ( CONE = ( 1.0E+0, 0.0E+0 ) )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      REAL               SSMAX
      COMPLEX            A11, A12, A22, C, TAU
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC          ABS, CONJG
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Functions ..
</span>      COMPLEX            CDOTC
      EXTERNAL           CDOTC
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           CAXPY, <a name="CLARFG.70"></a><a href="clarfg.f.html#CLARFG.1">CLARFG</a>, <a name="SLAS2.70"></a><a href="slas2.f.html#SLAS2.1">SLAS2</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Quick return if possible
</span><span class="comment">*</span><span class="comment">
</span>      IF( N.LE.1 ) THEN
         SSMIN = ZERO
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Compute the QR factorization of the N-by-2 matrix ( X Y )
</span><span class="comment">*</span><span class="comment">
</span>      CALL <a name="CLARFG.83"></a><a href="clarfg.f.html#CLARFG.1">CLARFG</a>( N, X( 1 ), X( 1+INCX ), INCX, TAU )
      A11 = X( 1 )
      X( 1 ) = CONE
<span class="comment">*</span><span class="comment">
</span>      C = -CONJG( TAU )*CDOTC( N, X, INCX, Y, INCY )
      CALL CAXPY( N, C, X, INCX, Y, INCY )
<span class="comment">*</span><span class="comment">
</span>      CALL <a name="CLARFG.90"></a><a href="clarfg.f.html#CLARFG.1">CLARFG</a>( N-1, Y( 1+INCY ), Y( 1+2*INCY ), INCY, TAU )
<span class="comment">*</span><span class="comment">
</span>      A12 = Y( 1 )
      A22 = Y( 1+INCY )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Compute the SVD of 2-by-2 Upper triangular matrix.
</span><span class="comment">*</span><span class="comment">
</span>      CALL <a name="SLAS2.97"></a><a href="slas2.f.html#SLAS2.1">SLAS2</a>( ABS( A11 ), ABS( A12 ), ABS( A22 ), SSMIN, SSMAX )
<span class="comment">*</span><span class="comment">
</span>      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="CLAPLL.101"></a><a href="clapll.f.html#CLAPLL.1">CLAPLL</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>
